package Thread_Demo;//循环使用public class demo6 {    public static void main(String[] args) {        Object lock1 = new Object();        Object lock2 = new Object();        Thread t1 = new Thread(()->{            synchronized(lock1)            {                System.out.println("线程1申请锁1");                synchronized(lock2)                {                    System.out.println("线程1申请锁2");                }            }        });        Thread t2 = new Thread(()->{            synchronized(lock2)            {                System.out.println("线程2申请锁2");                synchronized(lock1)                {                    System.out.println("线程2申请锁1");                }            }        });        t1.start();        t2.start();        try {            t1.join();            t2.join();        } catch (InterruptedException e) {            e.printStackTrace();        }    }}